package com.neusoft.yuejian_6.model;
import com.neusoft.yuejian_6.javabean.Contest;
import com.neusoft.yuejian_6.service.ContestService;
import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

import static com.neusoft.yuejian_6.base.Constant.BASE_URL;

/**
 * Created by Q on 2017/10/10.
 */

public class ContestModel {
    private Retrofit retrofit;

    public ContestModel() {
        retrofit = new Retrofit.Builder()
                .baseUrl(BASE_URL)
                .addConverterFactory(GsonConverterFactory.create())
                .build();
    }

    public Call Contests() {
        ContestService contestService = retrofit.create(ContestService.class);
        return contestService.getAllContests();
    }
    public Call<Contest> getContestById(int contest_id){
        ContestService contestService=retrofit.create(ContestService.class);
        return contestService.getContestById(contest_id);
    }
}